<template>
  <div class="app-container">
    <div id="printBox">
      <img src="../../../assets/images/logo.png" alt="" />
    </div>
    <el-button @click="getPrintData">打印</el-button>
  </div>
</template>
<script setup lang="ts">
import printJS from "print-js";
defineOptions({
  name: "PrintJsDemo",
  inheritAttrs: false,
});

// 开始打印
function getPrintData() {
  printJS({
    printable: "printBox", // id
    type: "html", //打印类型
    imageStyle: "width:100%;margin-bottom:20px;",
  });
}
</script>

<style lang="scss" scoped>
.app-container {
  height: inherit;
  overflow: scroll;
}
</style>
